<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>车辆资产信息</title>
    <link rel="stylesheet" href="../../js/bower_components/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="../../js/bower_components/bootstrap-select/dist/css/bootstrap-select.min.css">
    <link rel="stylesheet" href="../../js/bower_components/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css">
    <link rel="stylesheet" href="../../js/bower_components/bootstrap-table/dist/bootstrap-table.min.css">
    <link rel="stylesheet" href="../../js/bower_components/bootstrap-treeview/dist/bootstrap-treeview.min.css">

    <script src="../../js/bower_components/jquery/dist/jquery.min.js"></script>
    <script src="../../js/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="../../js/bower_components/bootbox.min.js"></script>
    <script src="../../js/bower_components/bootstrap-select/js/bootstrap-select.js"></script>
    <script src="../../js/bower_components/bootstrap-switch/dist/js/bootstrap-switch.min.js"></script>
    <script src="../../js/bower_components/bootstrap-table/dist/bootstrap-table.min.js"></script>
    <script src="../../js/bower_components/bootstrap-table/dist/locale/bootstrap-table-zh-CN.js"></script>
    <script src="../../js/bower_components/bootstrap-treeview/dist/bootstrap-treeview.min.js"></script>
    <script src="../../js/bower_components/jquery-form-validator/form-validator/jquery.form-validator.min.js"></script>
    <script src="../../js/bower_components/moment/min/moment-with-locales.min.js"></script>

  
    <script>
        $(function (){
            initRole();
            // inittable();
            init();
        })

        function initRole() {
            $("#selDept").empty;
            $.ajax({
                type: "get",
                url: "",
                dataType: "json",
                success: function (res) {
                    console.log(res);
                    if(!res.flag){
                        $.each(res,function(i,n){
                            $("#selDept").append("<option value=\""+n.dept+"\">"+n.dept+"</option>")
                        });
                        $("#selDept").append("<option value='全部'>全部</option>");
						$("#selDept").selectpicker('refresh');
                    }
                }
            })
        }

        function init() {
            console.log("列表数据测试");
            $.ajax({
                type: "post",
                url: "http://121.37.241.58:8883/logic/assets/car/list",
                dataType: "json",
                success: function (res) {
                    console.log(res);
                }
            })
        }

        function inittable(){
            $("#tblResult").bootstrapTable("destroy");
            $("#tblResult").bootstrapTable({
                loadMsg: "正在加载数据....",
                type: "post",
                url: "http://121.37.241.58:8883/logic/assets/car/list",
                sidePagination: 'client',
                pageSize: "5",
                Pageinatin: true,
                idField: "id",
                columns:[{
                    field: "assetscode",
                    title: "资产编码",
                    halign: 'center'
                },{
                    field: "namecn",
                    title: "资产名称",
                    halign: 'center'
                },{
                    field: "carbrand",
                    title: "品牌",
                    halign: 'center'
                },{
                    field: "normalmodel",
                    title: "型号",
                    halign: 'center'
                },{
                    field: "engineinfo",
                    title: "发动机编号",
                    halign: 'center'
                },{
                    field: "powertype",
                    title: "动力类型",
                    halign: 'center'
                },{
                    field: "autotrans",
                    title: "是否为自动挡",
                    halign: 'center'
                }]
            })
        }

        $.post(
            "http://121.37.241.58:8883/logic/assets/car/list",
            function(data) {
                console.log(data),
                $('#tblResult').bootstrapTable("destroy");
                $("#tblResult").bootstrapTable({
                    
                // loadMsg: "正在加载数据....",
                // pageSize: "5",
                // Pageinatin: true,
                idField: "id",
                columns:[{
                    field: "assetscode",
                    title: "资产编码",
                    halign: 'center'
                },{
                    field: "namecn",
                    title: "资产名称",
                    halign: 'center'
                },{
                    field: "carbrand",
                    title: "品牌",
                    halign: 'center'
                },{
                    field: "normalmodel",
                    title: "型号",
                    halign: 'center'
                },{
                    field: "engineinfo",
                    title: "发动机编号",
                    halign: 'center'
                },{
                    field: "powertype",
                    title: "动力类型",
                    halign: 'center'
                },{
                    field: "autotrans",
                    title: "是否为自动挡",
                    halign: 'center'
                }]
            })
            },
            "json"
        );

        $.ajax({
            url: "http://121.37.241.58:8883/logic/assets/car/list",
            // data: JSON.stringify(data),
            type: "POST",
            dataType: "json",
            async: false,
            contentType: "application/json", //必须这样写POST   还要加JSON.stringify()    
            success: function (data) {
                console.log("第二次测试")
                console.log(data);
            },
        });
    </script>
</head>
<body>
    <!-- 检索区域 -->
   <div class="container-fluid">
        <div class="row col-md-10">
            <div id="SearchForm" class="form-inline">
                <div class="input-group">
                    <label for="selPowerType">发动机类型：</label>
                        <select id="selPowerType">
                            <option value="-1">全部</option>
                        </select>
                </div>&nbsp;&nbsp;&nbsp;&nbsp;
                <div class="input-group">
                    <label for="tbxBrandMode">品牌/型号：</label>
                    <input type="text" id="tbxBrandMode">
                </div>&nbsp;&nbsp;&nbsp;&nbsp;
                <div class="input-group">
                    <label for="ckbAutoTrans">自动挡：</label> 
                    <input type="checkbox" id="ckbAutoTrans" checked/>
                </div>&nbsp;&nbsp;&nbsp;&nbsp;
                <div class="form-group">
                    <button type="button" id="btnSearch" class="btn btn-primary">搜索</button>
                </div>
            </div>
        </div>
        <!-- 功能区域 --> 
        <div class="col-md-10"> 
            <div id="toolsButtons">
                <button type="button" id="btnAdd" class="btn-success">
                    <span class="glyphicon glyphicon-plus">新增车辆 Add</span>
                </button>
                <button type="button" id="btnInstockShow" class="btn-primary"> 
                    <span class="glyphicon glyphicon-download-alt">车辆入库 Instock</span>
                </button>
                <button type="button" id="btnEdit" class="btn-warning"> 
                    <span class="glyphicon glyphicon-edit">编辑车辆 Edit </span>
                </button> 
            </div>
        </div>
        <br>
        <!-- 列表区域 -->
        <div class="row col-md-10">
            <table id="tblResult"></table>
        </div>
   </div>
</body>
</html>